<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title></title>
    <script type="text/javascript" src="../assets/js/vue.2.0.1.js"></script>
</head>

<body>
    <h2>v-on监听事件</h2>
    <div id="app">
        比赛得分：{{count}}
        <div>
            <button v-on:click="add">+</button>
            <button v-on:click="reduce">-</button>
        </div>

        <!-- 简写 @ -->
        <div>
            <button @click="add">+</button>
            <button @click="reduce">-</button>
        </div>

    </div>
    <script type="text/javascript">
        var app = new Vue({
            el: '#app',
            data: {
                count: 1
            },
            methods: {
                add: function () {
                    this.count++;
                },
                reduce: function () {
                    this.count--;
                }
            }
        })
    </script>
</body>

</html>